import os
from PIL import ImageGrab

def take_screenshot(save_path):
    """
    截取屏幕指定区域并保存
    """
    img = ImageGrab.grab()
    img.save(save_path)
    print(f"截图已保存到: {save_path}")

def ensure_screenshot_dir(directory):
    if not os.path.exists(directory):
        os.makedirs(directory) 